import { http } from '@/utils/http/axios';

// 图片上传
export function upload(data) {
  return http.request({
    url: '/upload',
    method: 'post',
    data,
  });
}

// 状态列表
export function stateList(params?) {
  return http.request({
    url: '/state_list',
    method: 'get',
    params,
  });
}

// 获取全局配置
export function getGlobalConfig() {
  return http.request({
    url: '/config/global',
    method: 'get',
  });
}

// 获取系统配置
export function systemConfig() {
  return http.request({
    url: '/config/system',
    method: 'get',
  });
}

// 更新系统配置
export function setSystemConfig(data) {
  return http.request({
    url: '/config/system',
    method: 'PATCH',
    data,
  });
}

// 获取验证码
export function getCaptcha(guestId) {
  return http.request({
    url: `/captcha/image/${guestId}`,
    method: 'get',
  });
}

// 获取枚举字典数据
export function getEnumList(keys) {
  return http.request({
    url: `/enum/dictionarys/${keys}`,
    method: 'get',
  });
}
